<template>
  <div>
    <div class="pageheader">
      <XHeader :left-options="{backText:''}" :title="xheader.title" class="XHeader"></XHeader>
    </div>
    <div class="pagetop">
      <div class="flex flex-center topbar">
        <div class="flex-full inputbox flex flex-center" @click="onSearchTap">
          <img class="icon" mode="aspectFit" src="@/assets/img/ic_search.png">
          <input style="text-align: left" class="input flex-full" disabled placeholder="搜索商品">
        </div>
      </div>
      <div class="toptab">
        <div
          v-for="(item,index) in tab"
          :key="index"
          class="item"
          :class="tabIndex==index?'active':''"
          @click="onTabTap(index)"
        >{{item}}
        </div>
      </div>
    </div>
    <div class="page">
      <div v-if="tabIndex==0" style="margin-top:12px;">
        <div class="block">
          <div class="brokerageitem">
            <div class="header">
              <div class="ordernumber">订单号:888888888888888888</div>
              <div class="state">待发货</div>
            </div>
            <div class="content">
              <img class="image" src>
              <div style="flex:1;">
                <div class="titlebar">
                  <div class="title">Kinven灭蚊魔方</div>
                  <div class="price">￥189.00</div>
                </div>

                <div class="pricebar">
                  <div style="flex:1">X1</div>
                </div>
              </div>
            </div>
            <div class="footer">
              <div class="left"></div>
              <div class="right">
                <div class="buttom">查看物流</div>
              </div>
            </div>
          </div>
        </div>

        <div class="block">
          <div class="brokerageitem">
            <div class="header">
              <div class="ordernumber">订单号:888888888888888888</div>
              <div class="state">待收货</div>
            </div>
            <div class="content">
              <img class="image" src>
              <div style="flex:1;">
                <div class="titlebar">
                  <div class="title">Kinven灭蚊魔方</div>
                  <div class="price">￥189.00</div>
                </div>

                <div class="pricebar">
                  <div style="flex:1">X1</div>
                </div>
              </div>
            </div>
            <div class="footer">
              <div class="left"></div>
              <div class="right">
                <div class="buttom">确认收货</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div v-if="tabIndex==3" style="margin-top:12px;">
        <div class="block">
          <div class="brokerageitem">
            <div class="header">
              <div class="ordernumber">订单号:888888888888888888</div>
              <div class="state">待返还</div>
            </div>
            <div class="content">
              <img class="image" src>
              <div style="flex:1;">
                <div class="titlebar">
                  <div class="title">Kinven灭蚊魔方</div>
                  <div class="price">￥189.00</div>
                </div>

                <div class="pricebar">
                  <div style="flex:1">X1</div>
                </div>
              </div>
            </div>
            <div class="footer">
              <div class="left"></div>
              <div class="right">
                <div class="buttom">发货</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'WelfareOrder',
    data () {
      return {
        xheader: {
          title: '福利订单'
        },
        tab: ['所有订单', '待发货', '待收货', '售后'],
        tabIndex: 0
      }
    },
    methods: {
      onSearchTap () {
      },
      onTabTap (index) {
        this.tabIndex = index
      }
    }
  }
</script>

<style lang="less" scoped>
  .page {
    padding-top: 90px;
    padding-bottom: 12px;
  }

  .pagetop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
  }

  .topbar {
    box-sizing: border-box;
    background-color: #fff;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .topbar .icon {
    width: 20px;
    height: 20px;
    padding-left: 12px;
    padding-right: 12px;
    display: block;
  }

  .topbar .inputbox {
    background: #fbf8f7;
    height: 35px;
  }

  .topbar .input {
    font-size: 12px;
    color: #351009;
    text-align: center;
    line-height: 17px;
  }

  .toptab {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    padding-left: 12px;
    padding-right: 12px;
    height: 45px;
    background-color: #fff;
  }

  .toptab > .item {
    flex: 1;
    height: 100%;
    display: block;
    line-height: 45px;
    font-size: 14px;
    color: #351009;
    opacity: 0.2;
    text-align: center;
    position: relative;
  }

  .toptab > .item.active {
    opacity: 1;
  }

  .toptab > .item.active::after {
    position: absolute;
    content: "";
    width: 100%;
    bottom: 0;
    left: 0;
    height: 1px;
    background: #b0290f;
  }

  .brokeragebox {
    display: block;
    background-color: #fff;
  }

  .brokeragebox .des {
    font-size: 12px;
    color: #351009;
    line-height: 17px;
    opacity: 0.5;
  }

  .brokeragebox .box {
    padding: 20px 16px;
  }

  .brokeragebox .brokerage {
    margin-top: 7px;
    font-size: 40px;
    color: #ae2309;
    line-height: 56px;
  }

  .brokeragebox button {
    font-size: 16px;
    color: #fff;
    height: 48px;
    line-height: 48px;
  }

  .brokerageitem {
    background-color: #fff;
  }

  .brokerageitem .header {
    display: flex;
    padding: 12px 16px;
    font-size: 12px;
    line-height: 17px;
    align-items: center;
  }

  .brokerageitem .ordernumber {
    flex: 1;
    color: #9f8d89;
  }

  .brokerageitem .state {
    color: #b0290f;
  }

  .brokerageitem .await {
    color: #b0290f;
  }

  .brokerageitem .employ {
    color: #06ad7e;
  }

  .brokerageitem .complete {
    color: #52322c;
  }

  .brokerageitem .return {
    color: #f4b13b;
  }

  .brokerageitem .content {
    display: flex;
    flex-direction: row;
    padding: 12px 16px;
    border-top: 1px solid #fbf8f7;
    border-bottom: 1px solid #fbf8f7;
    align-items: center;
  }

  .brokerageitem .content .image {
    width: 90px;
    height: 90px;
    display: block;
    margin-right: 24px;
    background-color: #f5f5f5;
  }

  .brokerageitem .content .titlebar {
    display: flex;
    flex-direction: row;
  }

  .brokerageitem .content .title {
    flex: 1;
    font-size: 14px;
    color: #9f8d89;
    line-height: 20px;
    font-weight: 500;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .brokerageitem .content .pricebar {
    margin-top: 5px;
    display: flex;
    align-items: center;
    flex-direction: row;
    font-size: 14px;
    color: #351009;
    line-height: 20px;
  }

  .brokerageitem .content .price {
    font-size: 14px;
    color: #b0290f;
  }

  .brokerageitem .footer {
    padding: 12px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .brokerageitem .footer .left {
    flex: 1;
    display: flex;
    align-items: center;
  }

  .brokerageitem .footer .right {
    display: flex;
    align-items: center;
  }

  .brokerageitem .footer .group {
    height: 24px;
    display: block;
    box-sizing: border-box;
    width: 54px;
    border: 1px solid #46241e;
    font-size: 10px;
    color: #46241e;
    line-height: 22px;
    text-align: center;
    border-radius: 12px;
  }

  .brokerageitem .footer .group.grouping {
    color: #b0290f;
    border-color: #b0290f;
  }

  .brokerageitem .footer .group + .group {
    margin-left: 8px;
  }

  .brokerageitem .footer .buttom {
    height: 28px;
    display: block;
    box-sizing: border-box;
    width: 64px;
    font-size: 12px;
    color: #46241e;
    line-height: 26px;
    text-align: center;
    border: 1px solid #d4d4d4;
  }

  .brokerageitem .footer .buttom.buttomred {
    color: #fff;
    border-color: #b0290f;
    background-color: #b0290f;
  }

  .brokerageitem .footer .buttom + .buttom {
    margin-left: 8px;
  }
</style>
